var Rotation = 0.0;

main();

function main() {
    const canvas = document.querySelector('#canvas1');
    const gl = canvas.getContext('webgl')

    if (!gl) {
        alert('加载失败，请更换浏览器');
        return;
    }

    initEventHandlers(canvas);

    const shaderProgramInfo = createNormalShaderProgramInfo(gl);

    var then = 0;

    function render(now) {
        var packedInfos = [];

        //创建穿心正方体
        const passedcude_buffer = PassedCube_bufferInit(gl);

        passedcude_modelmatrixInfo = {
            translateAttri: [0.0, 0.0, -6.0],
            rotateSpeed: [1.0, 0.7, 0.8],
        };
        const passedcube_matrix = createModelViewMatrix(passedcude_modelmatrixInfo);

        const passedcube_packedInfo = packInfo(passedcude_buffer, passedcube_matrix, shaderProgramInfo);
        packedInfos.push(passedcube_packedInfo);
        //////////



        now *= 0.001;
        const deltaTime = now - then;
        then = now;

        drawScene(gl, packedInfos, deltaTime);

        requestAnimationFrame(render)
    }

    requestAnimationFrame(render)
}